<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<%@ include file="/pages/template/page-begin.jspf" %>
<%
	_pageTitle = "Create Game | Admin"; 
	_pageId = "creategame"; 
	_mainPageId = "admin"; 
%>
<%@ include file="/pages/template/head-begin.jspf" %>
<%@ include file="/pages/template/head-end.jspf" %>

<body>
	<%@ include file="/pages/template/content-begin.jspf" %>
	<%@ include file="/pages/admin/admin-bar-left.jspf" %>
	
	<div class="fillContent">	
	<div id="content">	
	<div class="contentFillBox">
	
	
	<% boolean isPostRequest = "POST".equals(request.getMethod()); %>
	<jsp:useBean id="createGameForm" class="com.mobilottery.simulation.CreateGameForm" scope="session"/>
	<%
		if(isPostRequest)//submitted form?
		{
			createGameForm.touch();
		}
		else
		{
			createGameForm.reset();			
		}
	%>	
	<jsp:setProperty name="createGameForm" property="*" />
	<%
		if(isPostRequest)//submitted form?
		{
			createGameForm.submit();
		}
	%>	
	
	<% if(!isPostRequest || !createGameForm.isSubmitted()){ %>
	 	
	<form class="detailForm" action="" method="post">
	<table border="0" class="formTable" align="center">
	<tr>
		<th colspan="3">Create Simulated Game</th>
	</tr>
	<tr>
		<td>Description:</td>
		<td class="fieldc">
			<input type="text" value="<%=createGameForm.getDescription()%>" name="description" />
			<div class="fieldErrorMessage"><%=createGameForm.getFieldErorrMesssage("description")%></div>
		</td>		
	</tr>	
	<tr>
		<td>Participation Cost:</td>
		<td class="fieldc">
			<input type="text" value="<%=createGameForm.getParticipationCost()%>" name="participationCost" />
			<div class="fieldErrorMessage"><%=createGameForm.getFieldErorrMesssage("participationCost")%></div>
		</td>		
	</tr>
	<tr>
		<td>Maximal Prize:</td>
		<td class="fieldc">
			<input type="text" value="<%=createGameForm.getMaxPrize()%>" name="maxPrize" />
			<div class="fieldErrorMessage"><%=createGameForm.getFieldErorrMesssage("maxPrize")%></div>
		</td>		
	</tr>	
	<tr>
		<td>openDate:</td>
		<td class="fieldc">
			<input type="text" value="<%=createGameForm.getOpenDate()%>" name="openDate" />
			<div class="fieldErrorMessage"><%=createGameForm.getFieldErorrMesssage("openDate")%></div>
		</td>		
	</tr>		
	<tr>
		<td>closeDate:</td>
		<td class="fieldc">
			<input type="text" value="<%=createGameForm.getCloseDate()%>" name="closeDate" />
			<div class="fieldErrorMessage"><%=createGameForm.getFieldErorrMesssage("closeDate")%></div>
		</td>		
	</tr>		
	<tr>
		<td>resultDate:</td>
		<td class="fieldc">
			<input type="text" value="<%=createGameForm.getResultDate()%>" name="resultDate" />
			<div class="fieldErrorMessage"><%=createGameForm.getFieldErorrMesssage("resultDate")%></div>
		</td>		
	</tr>		
	<tr>
		<td colspan="3" align="right">
		<hr />
		</td>
	</tr>	
	<tr>
		<td align="left">
			<a href="">Clear</a>
		</td>
		<td colspan="2" align="right">
			<input type="submit" class="formBtn" value="Create" style="width: 100px;" />
		</td>
	</tr>	
	<tr>
		<td class="fieldErrorMessage" colspan="3" align="center" style="font-size: 14px;"><%=createGameForm.getFieldErorrMesssage("form")%></td>
	</tr>
	</table>
	</form>
	
	<%}else{ %>
	<table border="0" class="formTable" align="center" style="width:300px;"">
	<tr>
		<th>Creation Succesfull</th>
	</tr>
	<tr>
		<td>
		<p>
		Game #<i><%=createGameForm.getCreatedId()%></i> has been created succesfully.
		</p>
		<p>
		The game will be scheduled for execution on close date.
		</p> 
		</td>		
	</tr>
	</table>	
	<%} %>
	
	
	
	</div>
	</div>
	</div>

	<jsp:include page="/pages/template/content-end.jspf" />
	
</body>
</html>
